package com.mate.cloud.user.controller;

import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.net.InetAddress;

@RestController
public class K8SController {

    String result = "";

    @RequestMapping("/k8s")
    public String k8s() {
        try {
            // 用getLocalHost() 方法创建的InetAddress对象
            InetAddress address = InetAddress.getLocalHost();
            result = "hostname: " + address.getHostName() + " hostadress: " + address.getHostAddress();
            System.out.println();
            System.out.println();
            System.out.println();
            System.out.println();

        } catch (Exception e) {
            e.printStackTrace();
        }
        return "hello K8s <br/> " + result;
    }

    @GetMapping("/dockerfile")
    public String dockerfile() {
        return "hello docker v2 dockerfile";
    }
}
